<?php 

namespace town\model;

use town\dmod\DB;
use town\dmod\Model;
use town\base\Request;

class User extends Model
{
    public function auth()
    {
        $name = Request::post('name');
        $info = DB::table('auth')->where(['name','eq', $name])->first();
        if (empty($info)) {
            return '该用户不存在!!!';
        }
        $pass = Request::post('pass');
        if ($info['pass'] != md5($pass.$info['salt'])) {
            return '用户密码错误!!!';
        }
        return $info;
    }
}